<html>
    <head>
        <link rel="stylesheet" href="bootstrap/css/app.css"/>
        <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
        <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"/>
        <link rel="stylesheet" href="bootstrap/css/bootstrap-tagsinput.css"/>
    </head>
    <body>
    <div class="example_tagclass">
    <input type="text"  /><!-- value="Amsterdam,Washington" data-role="tagsinput" -->
    </div>
    <script src="bootstrap/js/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap3_bootstrap.min.js"></script>
    <script src="bootstrap/js/angular.min.js"></script>
    <script src="bootstrap/js/bootstrap-tagsinput.js"></script>
    <script src="bootstrap/js/app.js"></script>
    <script src="bootstrap/js/app_bs3.js"></script>
    <script src="bootstrap/js/bootstrap-tagsinput-angular.js"></script>
    <script src="bootstrap/js/typeahead.bundle.js"></script>
<script type="text/javascript">
/*
var citynames = new Bloodhound({
  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
  queryTokenizer: Bloodhound.tokenizers.whitespace,
  prefetch: {
    url: 'bootstrap/citynames.json'
    //filter: function(list) {
//      return $.map(list, function(cityname) {
//        return { name: cityname }; });
//    }
  }
});
citynames.initialize();

$('input').tagsinput({
  typeaheadjs: {
    name: 'cityname',
    displayKey: 'name',
    valueKey: 'name',
    source: citynames.ttAdapter()
  }
});
*/
var cities = new Bloodhound({
  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('text'),
  queryTokenizer: Bloodhound.tokenizers.whitespace,
  prefetch: 'bootstrap/cities.json'
});
cities.initialize();

var elt = $('input');
elt.tagsinput({
  tagClass: function(item) {
    switch (item.continent) {
      case 'Europe'   : return 'label label-primary';
      case 'America'  : return 'label label-danger label-important';
      case 'Australia': return 'label label-success';
      case 'Africa'   : return 'label label-default';
      case 'Asia'     : return 'label label-warning';
    }
  },
  itemValue: 'value',
  itemText: 'text',
  typeaheadjs: {
    name: 'cities',
    displayKey: 'text',
    source: cities.ttAdapter()
  }
});
elt.tagsinput('add', { "value": 1 , "text": "Amsterdam"   , "continent": "Europe"    });
elt.tagsinput('add', { "value": 4 , "text": "Washington"  , "continent": "America"   });
elt.tagsinput('add', { "value": 7 , "text": "Sydney"      , "continent": "Australia" });
elt.tagsinput('add', { "value": 10, "text": "Beijing"     , "continent": "Asia"      });
elt.tagsinput('add', { "value": 13, "text": "Cairo"       , "continent": "Africa"    });
</script>
    </body>
</html>